package drds.binlog.database_driver.packets.server;

import drds.binlog.common.Authors;
import drds.binlog.database_driver.packets.PacketWithHeaderPacket;
import drds.binlog.database_driver.utils.LengthCodedStringReader;
import drds.common.Author;
import lombok.Getter;
import lombok.Setter;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@Author(name = Authors.LI_YANG)
public class RowDataPacket extends PacketWithHeaderPacket
{

    @Setter
    @Getter
    private List<String> columnNameList = new ArrayList<String>();


    public void fromBytes(byte[] bytes) throws IOException
    {
        int index = 0;
        LengthCodedStringReader lengthCodedStringReader = new LengthCodedStringReader(index, null);
        do
        {
            getColumnNameList().add(lengthCodedStringReader.readLengthCodedString(bytes));
        } while (lengthCodedStringReader.getStartIndex() < bytes.length);
    }

    public byte[] toBytes() throws IOException
    {
        return null;
    }


}
